#ifndef DAYLEAVE_H
#define DAYLEAVE_H
#include<QString>
#include<string>
#include <vector>
enum DAY{
    MONING=1,
    AFTER=2,
    ALL=3
};

struct OneLeave{
    std::string m_id ;
    std::string m_name;
    std::string reason;
    int time;
    OneLeave operator=(const OneLeave& leave)const {
        OneLeave temp;
        temp.m_id = leave.m_id;
        temp.m_name = leave.m_name;
        temp.time = leave.time;
        return temp;
    }

    bool operator==(const OneLeave& leave) const{
        if(m_id == leave.m_id&&
                m_name == leave.m_name&&
                time == leave.time){
            return true;
        }
        return false;;
    }
};

class DayLeave
{
private:
    std::string date;
    std::vector<OneLeave> leaves; //array
public:
    DayLeave(const std::string date );
    std::string toJson();
    bool addLeave(const OneLeave  oneleave);
    bool initFromJsonString(const std::string & jsonStr);
};


#endif // DAYLEAVE_H
